<template>
  <div class="dogbox">
    <div>
<img :src="imgUrl" >
</div>
<div>
<p class="text" @click="add(index1)">{{dogname}}</p>
</div>
  </div>
</template>

<script>
export default {
  props: ['imgUrl', 'dogname', 'arr', 'index1', 'arr1'],
  created () {

  },

  methods: {

    add (index) {
      // this.goodList.del(index)
      // alert(index)
      console.log(this.arr)
      console.log(index)
      // this.arr.indexOf(index)
      // console.log(this.arr.indexOf(index))
      // var name = ''

      for (var i = 0; i < this.arr.length; i++) {
        if (i === index) {
          console.log(this.arr[i].dogName)
          this.arr1.push(this.arr[i].dogName)
          break
        }
      }
    }

  }
}
</script>

<style  lang='less'>
.dogbox{
  // display: flex;
  // float: left;
  width: 200px;
  height: 190px;
  border: 1px solid #333;
}
img{
  width: 100%;
  height: 150px;
}
p{
  text-align: center;
  line-height: 1px;
}
</style>
